import {fromJS} from 'immutable';
import * as constants from './constants';

const defaultState = fromJS({
    menuList: [],
    show: true,
});

export default (state = defaultState, action) => {
    switch (action.type) {
        case constants.MENU_LIST:
            return state.merge({
                menuList: fromJS(action.menuList)
            });
        case constants.ONCLICK_OUT:
            return ({
                show: fromJS(action.show)
            });
        default:
            return state;
    }
}